<nav class="site-themeNav">
  <div class="container" style="position: relative;z-index: 9;">
    <div class="navbar nav-primary navbar-kppwdefault">
      <div class="navbar-header">
        <button data-target=".navbar-collapse" data-toggle="collapse" class="navbar-toggle" type="button">
          <span class="sr-only">切换导航</span>
          <span class="icon-bar"></span>
          <span class="icon-bar"></span>
          <span class="icon-bar"></span>
        </button>
        <span class="navbar-actived">网站导航</span>
        <input type="hidden" id="route" value="{$do}">

        <div class="all-tasktype-header">
          <span>全部{if $do == 'goodslist' || $do == 'goods'}商品{else}任务{/if}分类</span> <span class="fa fa-exchange"></span><i class="fa fa-angle-down"></i>
        </div>

        <ul class="category-down" id="taskNavMenu">
          {loop $arrNewIndusCt $key $value}
          <li class="category-item">
            <div class="category-top">
              {loop $value $k1 $v1}
              {if $k1<2}
              <a href="index.php?do=tasklist&pd={$arrIndusPt[$key]['indus_id']}&i=$v1['indus_id']"  {if $v1['is_recommend']==1}class="hot"{/if}  tabindex="-1">$v1['indus_name']</a>、
              {/if}
            {/loop}
              <i class="fa fa-angle-right"></i>
            </div>
            <div class="category-inner">
              <h3 class="category-inner-title"><a href="index.php?do=tasklist&pd={$arrIndusPt[$key]['indus_id']}&i=0">全部{$arrIndusPt[$key]['indus_name']}</a></h3>
          {loop $value $k2 $v2}
                <a href="index.php?do=tasklist&pd={$arrIndusPt[$key]['indus_id']}&i=$v2['indus_id']" tabindex="-1" {if $v2['is_recommend']==1}class="hot"{/if}>$v2['indus_name']</a>
           {/loop}
            </div>
          </li>
          {/loop}
        </ul>

        <ul class="category-down" id="shopNavMenu">
         {loop $arrNewIndusCs $key $value}
          <li class="category-item">
            <div class="category-top">
              {loop $value $k1 $v1}
              {if $k1<2}
              <a href="index.php?do=goodslist&pd={$arrIndusPs[$key]['indus_id']}&i=$v1['indus_id']"  {if $v1['is_recommend']==1}class="hot"{/if}  tabindex="-1">$v1['indus_name']</a>、
        {/if}
            {/loop}
              <i class="fa fa-angle-right"></i>
            </div>
            <div class="category-inner">
              <h3 class="category-inner-title"><a href="index.php?do=goodslist&pd={$arrIndusPs[$key]['indus_id']}&i=0">全部{$arrIndusPs[$key]['indus_name']}</a></h3>
          {loop $value $k2 $v2}
                <a href="index.php?do=goodslist&pd={$arrIndusPs[$key]['indus_id']}&i=$v2['indus_id']" tabindex="-1" {if $v2['is_recommend']==1}class="hot"{/if}>$v2['indus_name']</a>
           {/loop}
            </div>
          </li>
              {/loop}
        </ul>

      </div>
      <!-- navbar-header -->
      <div class="navbar-collapse collapse">
        <ul class="nav navbar-nav nav-primary navbar-kppwdefault">
        {loop $nav_arr $k $v}
         <li {if $v['nav_style']==$do ||$v['nav_style']==$strNavActive}class="active"{/if} ><a href="{$v['nav_url']}" {if $v['newwindow']}target="_blank"{/if}><span>{$v['nav_title']}</span></a></li>
                <li class="line"></li>
        {/loop}
        </ul>
        <!--<ul class="nav navbar-nav navbar-right">
          <li><a href="#">诚信保障</a></li>
          <li><a href="#">VIP特权</a></li>
          <li><a href="#">增值工具</a></li>
        </ul>-->
      </div><!--/.nav-collapse -->       
    </div>
    <!--/.navbar -->
 
  </div>
  <!--/.container -->
  
</nav>
<!--/.site-nav -->
<script>

  $(function(){
    
   var route = $("#route").val();
   
    $(".category-down li:nth-child(12)").nextAll("li").hide();
    
    //隐藏商品分类
    if (route == 'goodslist' || route == 'goods') {
        $("#taskNavMenu").hide();
    } else {
        $("#shopNavMenu").hide();
    }
    
    var winWeight = $(window).width();


    //导航全部分类下拉菜单
    if( winWeight > 769){
      $('.navbar-header').hover(function(){
        var nav = $(".all-tasktype-header .fa-exchange");
        var navName = nav.prev("span").text();

        if (navName == '全部任务分类') {
          $("#taskNavMenu").show();
        } else {
          $("#shopNavMenu").show();
        }

        nav.click(function() {
          var content = $(this).prev("span").text();
          if (content == '全部任务分类') {
         
              $(this).prev("span").text('全部商品分类');
              $("#taskNavMenu").hide();

              $("#shopNavMenu").show();
          } else {
           
              $(this).prev("span").text('全部任务分类');
              $("#shopNavMenu").hide();
              $("#taskNavMenu").show();
          }
        });
    

      },function(){
        $("#taskNavMenu").hide();
        $("#shopNavMenu").hide();
        $(".all-tasktype-header .fa-exchange").unbind('click')
      });
    };
    if( winWeight < 768){
      $("#taskNavMenu").hide();
      $("#shopNavMenu").hide();      
    }


  })
</script>